import { View, Image, Text } from "@tarojs/components";
import "./index.scss";

export interface PersonCardProps {
  cid: string,
  portrait: string,
  name: string,
  state: number,
  onClick?: ((cid: string) => void),
}
const ConsultantState = ['空闲', '忙碌'];
const ConsultantCard: React.FC<PersonCardProps> = ({ cid, portrait, name, state, onClick }) => {
  return (<View className="consultant-card" onClick={() => onClick && onClick(cid)}>
    <Image className="consultant-card-portrait" src={portrait} />
    <View className="consult-card-name">{name}</View>
    <Text className="consult-card-score-title">综合评价</Text>
    <View className="consult-card-state" style={{ backgroundColor: `${state === 1 ? 'rgba(255,0,0,0.6)' : 'rgba(0,255,0,0.6)'}` }}>{ConsultantState[state]}</View>
  </View>)
}
export default ConsultantCard;
